package com.dialogue;

import com.badlogic.gdx.Gdx;
 
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.Sprite;
 
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.gamename.ViewWin;

public class Dialogue {
 
	public static boolean show=false;
	private BitmapFont dsprite;
	private Sprite frame;
	private int  D_WIDTH = 512;
	private int D_HEIGHT =256;
	private int start_x = 0;
	private int start_y = 0;
	
	private static Dialogue dlg=null;
	public static Dialogue getInstance(){
		if(dlg==null){
			dlg = new Dialogue();
		}
		return dlg;
	}
	
	public Dialogue()
	{
		start_x = ViewWin.getInstance().VIEW_WIDTH/2-D_WIDTH/2;
		start_y = ViewWin.getInstance().VIEW_HEIGHT/2-D_HEIGHT/2;
		FileHandle fhd = Gdx.files.internal("data/font/fz.fnt");
		dsprite = new BitmapFont(fhd ,Gdx.files.internal("data/font/fz.png"),false);
		
		Texture ct = new Texture(Gdx.files.internal("data/dlg/frame.png"));
		frame = new Sprite(ct);
		frame.setPosition(start_x,start_y);
		frame.setRotation(0);

	}
	public void drawDialogue(SpriteBatch batch,String text)
	{
		batch.begin();
		frame.draw(batch);
		dsprite.draw(batch,text,start_x+25,start_y+D_HEIGHT-25);
		batch.end();
	}
}
